﻿@model MvcApplication5.Models.IndexModel

@{
ViewBag.Title = "Home";
Layout = null;
}

@{  
    int i = 0;  
    var dtTopNews = (from item in Model.News where (item.NewsId == 1) select item);
    var dtNews = (from item in Model.News where (item.NewsId > 1 && item.NewsId < 5) select item);
    
    var mtbTopNews = (from item in Model.News where (item.NewsId == 5) select item);
    var mtbNews = (from item in Model.News where (item.NewsId > 5 && item.NewsId < 9) select item);
    
    var pcTopNews = (from item in Model.News where (item.NewsId == 9) select item);
    var pcNews = (from item in Model.News where (item.NewsId > 9 && item.NewsId < 13) select item);

    var hightlight01 = (from item in Model.News where (item.NewsId == 13) select item);
    var hightlight02 = (from item in Model.News where (item.NewsId == 14) select item);
    var hightlight03 = (from item in Model.News where (item.NewsId == 15) select item);
    var hightlight04 = (from item in Model.News where (item.NewsId == 16) select item);
    var hightlight05 = (from item in Model.News where (item.NewsId == 17) select item);
            
}

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link rel="stylesheet" type="text/css" href="/css/style.css"
    media ="all" />
</head>

<body>
<div class="main">
	<div class="header">
    </div> <!--End header-->
    <div class="header-footer"></div>
    <div class="menu">
    	<ul style="padding-right:0px;">
        	<li class="menu-sub"><a href="/NewsSite/Index" class="menu-sub-text">Trang chủ</a></li>            
                @foreach (var item in Model.Categories){
                    <li class="menu-sub"><a href="/NewsSite/Category/@item.CategoryId" class="menu-sub-text">@item.Name</a></li>                               
                }
        </ul>
    </div> <!--End menu-->
    
    <div class="body">
    	<div class="body-left">
           <div class="body-left-topic01">
           		<div class="body-left-topic-header01"></div>
                <div class="body-left-topic-content01">
                	<div class="body-left-topic-content01-highlight01">
                    	<div class="body-left-topic-content01-highlight-title">
                        	<a href="/NewsSite/Details/@hightlight01.First().NewsId" style="text-decoration:none"><h2 class="body-left-topic-content01-highlight01-text">@hightlight01.First().Title</h2></a>
                        </div>
                        <a href="/NewsSite/Details/@hightlight01.First().NewsId"><img class="body-left-topic-content01-highlight-image01" src="/css/images/@hightlight01.First().Image"></a>
                    </div>
					<div class="body-left-topic-content01-highlight02">
                    	<div class="body-left-topic-content01-highlight-title">
                        	<a href="/NewsSite/Details/@hightlight02.First().NewsId" style="text-decoration:none"><h2 class="body-left-topic-content01-highlight02-text">@hightlight02.First().Title</h2></a>
                        </div>
                    	<a href="/NewsSite/Details/@hightlight02.First().NewsId"><img class="body-left-topic-content01-highlight-image02" src="/css/images/@hightlight02.First().Image">
                    </div>
                    <div class="body-left-topic-content01-highlight02">
                    	<div class="body-left-topic-content01-highlight-title">
                        	<a href="/NewsSite/Details/@hightlight03.First().NewsId" style="text-decoration:none"><h2 class="body-left-topic-content01-highlight02-text">@hightlight03.First().Title</h2></a>
                        </div>
                    	<a href="/NewsSite/Details/@hightlight03.First().NewsId"><img class="body-left-topic-content01-highlight-image02" src="/css/images/@hightlight03.First().Image">
                    </div>
                    <div class="body-left-topic-content01-highlight02">
                    	<div class="body-left-topic-content01-highlight-title">
                        	<a href="/NewsSite/Details/@hightlight04.First().NewsId" style="text-decoration:none"><h2 class="body-left-topic-content01-highlight02-text">@hightlight04.First().Title</h2></a>
                        </div>
                    	<a href="/NewsSite/Details/@hightlight04.First().NewsId"><img class="body-left-topic-content01-highlight-image02" src="/css/images/@hightlight04.First().Image">
                    </div>
                    <div class="body-left-topic-content01-highlight02">
                    	<div class="body-left-topic-content01-highlight-title">
                        	<a href="/NewsSite/Details/@hightlight05.First().NewsId" style="text-decoration:none"><h2 class="body-left-topic-content01-highlight02-text">@hightlight05.First().Title</h2></a>
                        </div>
                    	<a href="NewsSite/Details/@hightlight05.First().NewsId"><img class="body-left-topic-content01-highlight-image02" src="/css/images/@hightlight05.First().Image"></a>
                    </div>
                </div> <!--End body-left-content01-->
           </div> <!--End body-left-topic01-->
           <!--<div class="body-left-topic02">
           		<div class="body-left-topic-header02"></div>
                <Div class="body-left-topic-content02">
                	<div></div>
                </Div>
           </div> <!--End body-left-topic02-->
           <div class="body-left-topic03">
           		<div class="body-left-topic-header03">
                	<div class="body-left-topic-header03-left">
                    	<div class="body-left-topic-header03-left-title">
							<h3 class="body-left-topic-header03-left-text">Tiêu điểm</h3>
                            
                        </div>
                    </div> <!--End body-left-topic-header03-left-->
                </div>
                <div class="body-left-topic-content03">
                	<div class="body-left-topic-content03-left">
                    	<a href="/NewsSite/Details/@dtTopNews.First().NewsId" style="text-decoration:none"><img src="/css/images/@dtTopNews.First().Image" class="body-left-topic-content03-left-img"></a>
                        <a href="/NewsSite/Details/@dtTopNews.First().NewsId" style="text-decoration:none"><h2 class="body-left-topic-content03-left-text">@dtTopNews.First().Title</h2></a>
                    </div> <!--End body-left-content03-left-->
                    <div class="body-left-topic-content03-right">
                    	<table class="body-left-topic-content03-right-table">                            
                            @foreach (var item in dtNews) {
                                <tr>
                                    <td><a href="/NewsSite/Details/@item.NewsId"><img src="/css/images/@item.Image" class="body-left-topic-content03-right-img"></a></td>
                                    <td><a href="/NewsSite/Details/@item.NewsId" style="text-decoration:none">@item.Title</a></td>
                                </tr>
                            }                           
                        </table>	
                    </div> <!--End body-left-content03-right-->                    
                </div> <!--End body-left-content03-->
           </div> <!--End body-left-topic03-01-->
           <div class="news-tab">
               <ul class="news-tab-menu">
                   <li class="news-tab-submenu2"><a href="/NewsSite/Index" class="news-tab-submenu-text2">Tin mới</a></li>
                   <li class="news-tab-submenu"><a href="" class="news-tab-submenu-text">Bài hot</a></li>
               </ul>
           </div>
           @foreach(var item in Model.News.Where(c => c.isHot == 1)){               
               if (i%2 == 0){                             
                    <div class="category-newslist">
                        <div class="category-newslist-image">
                            <a href="/NewsSite/Details/@item.NewsId"><img src="/CSS/images/@item.Image" style="width:230px; height:180px"/></a>
                        </div>
                        <div class="category-newslist-content">
                            <h2><a href="/NewsSite/Details/@item.NewsId" style="text-decoration:none">@item.Title</a></h2>
                            <p>Tác giả: @item.Author.Name | @item.PublishedDate</p>
                        </div>                        
                    </div>
               }else{
                   <div class="category-newslist2">
                        <div class="category-newslist-image">
                            <a href="/NewsSite/Details/@item.NewsId"><img src="/CSS/images/@item.Image" style="width:230px; height:180px"/></a>
                        </div>
                        <div class="category-newslist-content">
                            <h2><a href="/NewsSite/Details/@item.NewsId" style="text-decoration:none">@item.Title</a></h2>
                            <p>Tác giả: @item.Author.Name | @item.PublishedDate</p>
                        </div>                        
                    </div>
               }
               i++;
            }                                   
        </div> <!--End body-left-->
        <div class="body-right">
            <div class="body-right-header">
                @using(Html.BeginForm("Search","NewsSite")){
                    <input type="text" class="body-right-searchbar" name="searchString"/>
                    <input type="submit" class="body-right-searchbutton" value="Tìm kiếm"/>
                }
            </div>
            <div class="body-right-comment">
                <div class="body-right-header">
                    <h3 class="body-right-title">Comment mới nhất</h3>
                </div>
                @foreach (var item in Model.Comments)
                {                    
                    <div class="body-right-comment-content">
                        <span class="body-right-comment-content-text1">@item.Name</span>
                        <span class="body-right-comment-content-text2"><a>@item.Content</a></span>
                        <div class="body-right-comment-article"><a href="/NewsSite/Details/@item.News.NewsId" style="text-decoration:none">->  @item.News.Title</a></div>
                    </div>                    
                }
            </div>
        </div>
    </div> <!--End body-->
    
</div> <!--End main-->
</body>
</html>

